<?php


class Member extends Admin_controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->model('member_mdl','member');
	}
	
	public function index()
	{
		
		$count = $this->member->get_member_count();
		
		$this->load->library('pagination');
		$page = $this->uri->rsegment(4);		
		$page = ($page && is_numeric($page)) ? intval($page) : 1;
		$limit = 2;
		$offset = ($page - 1) * $limit;
		$config['base_url'] = base_url('adminroot/member/index/page/');
		$config['total_rows'] = $count;
		$config['per_page'] = $limit;
		$config['uri_segment'] = 5;
		
		$this->pagination->initialize($config); 

		//echo $this->pagination->create_links();
		$data['page'] = $this->pagination->create_links();
		$data['data'] = $this->member->get_all_member(true,$limit,$offset);
		//print_r($this->member->get_all_member(true,$limit,$offset));
		$this->load->view('adminroot/member',$data);
	}
	
	public function edit()
	{
		$id = $this->uri->rsegment(4);
		$user = $this->member->get_user_by_id($id);
		print_r($user);
	}
}